﻿$(function(){//延迟加载
	$('#dvresult').combobox({
		disabled:true
	});
	var pbelong='';
	$('#dvs').searchbox({
		searcher:function(value,name){
			pbelong=name;
			pip=value;
			if(value==''||name=='0'){
				alert('未输入');
			}else{
				$('#dvresult').combobox({
					disabled:false,
					value:'请选择',
					disabled:false,
					valueField: 'parentId',    
			        textField: 'parentname',
					url:"querybyip?dvbelong="+name+"&dvip="+value,
				});
			}
		}, 
		menu:'#mm1', 
		prompt:'设备ip..' 					
	});
	if($('#newdvId').val()!='0'&&$('#newdvId').val()!=''){
		$('#tbp2').load('todvparent',{
			//dvbelong:'',
			//devresId:'',
			//dvip:$('#getoltip').val(),
			//dvip:'',
			//dvname:'',
			dvId:$('#newdvId').val(),
		},function(){
			//alert($('#newdvId').val());
			$('#dvId').val($('#newdvId').val());
			$.getScript('/xasj/js/component/dvparent.js');

		});
	}
	
	$('#adddvnew').linkbutton({
		iconCls:'icon-search',
		text:'查询',
		width:'220px',
		onClick:function(){
			var dvId=$('#dvresult').combobox('getValue');
			if(dvId==''){
				alert('未选择!');
				return;
			}
			$('#tbp2').load('todvparent',{
				dvId:dvId,
				dvbelong:pbelong
			},function(){
				$.getScript('/xasj/js/component/dvparent.js');
			});
		}
	});
});